package com.jiyinit.web.core.demo.dao;


import com.jiyinit.core.framework.base.paging.PagingResult;
import com.jiyinit.core.framework.dao.mybatis.base.MybatisDaoContext;
import com.jiyinit.core.framework.dao.mybatis.paginator.domain.PageBounds;
import com.jiyinit.web.core.demo.entity.OrderEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

/**
 * <p></p>
 * <p>
 * <PRE>
 * <BR>	修改记录
 * <BR>-----------------------------------------------
 * <BR>	修改日期			修改人			修改内容
 * </PRE>
 *
 * @author lishaochuan on 2017/3/17 11:02
 * @version 1.0
 * @since 1.0
 */
@Repository("core.orderDao")
public class OrderDao {

    /**
     * 日志对象
     */
    private static Logger logger = LoggerFactory.getLogger(OrderDao.class);

    private String SQLID = "core.orderDao.";

    @Autowired
    @Qualifier("core.MybatisDaoContext")
    private MybatisDaoContext mybatisDaoContext;

    /**
     *
     * @author lishaochuan
     * @create 2017/3/19 10:27
     * @param
     * @return
     */
    public OrderEntity getOrderInfoByOrderSn(String orderSn){
        return mybatisDaoContext.findOne(SQLID + "getOrderInfoByOrderSn", OrderEntity.class, orderSn);
    }


    /**
     *
     * @author lishaochuan
     * @create 2017/3/19 10:27
     * @param
     * @return
     */
    public PagingResult<OrderEntity> getOrderList(PageBounds pageBounds) {
        return mybatisDaoContext.findForPage(SQLID + "getOrderList", OrderEntity.class, null,pageBounds);
    }


    /**
     *
     * @author lishaochuan
     * @create 2017/3/19 10:29
     * @param
     * @return
     */
    public int updateOrderByOrderSn(OrderEntity orderEntity){
        return mybatisDaoContext.update(SQLID + "updateOrderByOrderSn", orderEntity);
    }
}
